From: Richard M. Stallman Date: Tue, 10 Jul 2007 03:50:54 +0000 (+0000) Subject: (looking-at-p, string-match-p): New functions. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~421^2~18011 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=b70a256f5cd4ff495f3579d3b478c63bb6011b07;p=emacs.git (looking-at-p, string-match-p): New functions. --- diff --git a/lisp/subr.el b/lisp/subr.el index f890caf66e4..3804624b0b9 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2668,6 +2668,18 @@ of a match for REGEXP." (looking-at (concat "\\(?:" regexp "\\)\\'"))))) (not (null pos)))) +(defsubst looking-at-p (regexp) + "\ +Same as `looking-at' except this function does not change the match data." + (let ((inhibit-changing-match-data t)) + (looking-at regexp))) + +(defsubst string-match-p (regexp string &optional start) + "\ +Same as `string-match' except this function does not change the match data." + (let ((inhibit-changing-match-data t)) + (string-match regexp string start))) + (defun subregexp-context-p (regexp pos &optional start) "Return non-nil if POS is in a normal subregexp context in REGEXP. A subregexp context is one where a sub-regexp can appear.